<template>
  <div class="table">
    <div>
      <el-row :gutter="10">
        <el-col :span="4">
          <div>
            <el-select v-model="queryParams.typeo" clearable placeholder="看板类型">
              <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <search title="料件编号" :url="ljbh" :table-fields="ljbhFields" allowCheck="1" :index="imaa001"
                    :params="params2" ref="ljbh"></search>
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <search title="品管分群" :url="pgfq" :table-fields="pgfqFields" allowCheck="1" :index="oocq002"
                    :params="params3" ref="pgfq"></search>
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <search title="来源单号" :url="lydh" :table-fields="lydhFields" allowCheck="1" :index="pmdsdocno"
                    :params="params4" ref="lydh"></search>
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <search title="客户订购号" :url="khdgh" :table-fields="khdghFields" allowCheck="1" :index="xmda033"
                    :params="params5" ref="khdgh"></search>
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <el-button type="primary" @click="loadTable">查询</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <DYTable :table-fields="listFields" :result="tableData" allowCheck="0" @rowDbClick="clickRow"></DYTable>
    <pagination
        :v_show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="loadTable"
    />
  </div>
</template>

<script>
import {listpgfqTable, listlydhTable, listljbhTable, listkhdghTable, listTable} from "@/api/T100/aqcq";

export default {
  name: "aqcq100",
  data() {
    return {
      options: [{
        value: '1',
        label: 'IQC'
      }, {
        value: '2',
        label: 'FQC'
      }, {
        value: '3',
        label: 'PQC'
      }, {
        value: '4',
        label: 'OQC'
      }, {
        value: '5',
        label: 'Invenroty QC'
      }, {
        value: '6',
        label: 'RQC'
      }],
      tableData: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        typeo: '1',
        qcba010: '',
        qcba013: '',
        qcba001: '',
        xmda033: '',
      },
      imaa001: 'imaa001',
      oocq002: 'oocq002',
      pmdsdocno: 'pmdsdocno',
      xmda033: 'xmda033',
      params1: '',
      params2: 'set_aqcq100params2',
      params3: 'set_aqcq100params3',
      params4: 'set_aqcq100params4',
      params5: 'set_aqcq100params5',
      pgfq: listpgfqTable,
      ljbh: listljbhTable,
      khdgh: listkhdghTable,
      lydh: listlydhTable,
      pgfqFields: [{label: '应用分类码', prop: 'oocq002'}, {label: '说明', prop: 'oocql004'}],
      ljbhFields: [{label: '料号', prop: 'imaa001'}, {label: '品名', prop: 'imaal003'}, {label: '规格', prop: 'imaal004'}],//imaa001,imaal003,imaal004
      lydhFields: [{label: '单据单号', prop: 'pmdsdocno'}, {label: '单据日期', prop: 'pmdsdocdt'}, {
        label: '申请人员',
        prop: 'pmds002'
      },
        {label: '全名', prop: 'ooag011'}, {label: '申请部门', prop: 'pmds003'}, {label: '说明', prop: 'ooefl003'}],//pmdsdocno,pmdsdocdt,pmds002,ooag011,pmds003,ooefl003
      khdghFields: [{label: '客户订购号', prop: 'xmda033'}],
      listFields: [{label: '紧急程度', prop: 'qcba021'}, {label: '单号', prop: 'qcbadocno'}, {
        label: '单据日期',
        prop: 'qcbadocdt'
      }, {label: '来源单号', prop: 'qcba001'},
        {label: '来源单项次', prop: 'qcba002'}, {label: '参考单号', prop: 'qcba003'}, {
          label: '客户订购单号',
          prop: 'xmda033'
        }, {label: '参考单项次', prop: 'qcba004'},
        {label: 'RunCard', prop: 'qcba029'}, {label: '作业编号', prop: 'qcba006'}, {
          label: '说明',
          prop: 'oocql004'
        }, {label: '交易对象编号', prop: 'qcba005'},
        {label: '交易对象简称', prop: 'pmaal004'}, {label: '料件编号', prop: 'qcba010'}, {
          label: '品名',
          prop: 'imaal003'
        }, {label: '规格', prop: 'imaal004'},
        {label: '工程图号', prop: 'imaa041'}, {label: '产品特征', prop: 'qcba012'}, {
          label: '来源数量',
          prop: 'qcba017'
        }, {label: '单位', prop: 'qcba016'},
        {label: '说明', prop: 'oocal003'}, {label: '类型分类', prop: 'qcba031'}, {label: '备注', prop: 'pmdt059'},]
    }
  },
  computed: {},
  methods: {
    loadTable() {
      this.queryParams.qcba010 = this.$refs.ljbh.queryParams.keyword
      this.queryParams.qcba013 = this.$refs.pgfq.queryParams.keyword
      this.queryParams.qcba001 = this.$refs.lydh.queryParams.keyword
      this.queryParams.xmda033 = this.$refs.khdgh.queryParams.keyword
      listTable(this.queryParams).then(resp => {
        if (resp.code == '200') {
          this.tableData = resp.rows
          this.total = resp.total
        } else {
          this.$message.warning('查询信息异常')
        }
      })
    },
    clickRow(row) {
      this.$router.push(
          "/pinguan/aqct300_1/" + row.qcbadocno
      )
    }
  }
}
</script>

<style scoped lang="scss">
.table {
  margin: 10px;
}

</style>
